package it.webrules.deploymanager.webapp.controller;

import it.webrules.deploymanager.webapp.auth.LoginCookieManager;

import java.net.URISyntaxException;

import javax.inject.Inject;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.core.Response;
import javax.ws.rs.core.Response.ResponseBuilder;

import com.sun.jersey.spi.resource.PerRequest;

@PerRequest
@Path("services/logout")
public class LogoutController {

	@Inject
	private LoginCookieManager loginCookieManager;

	@Inject
	public LogoutController() {
	}

	@GET
	public Response logout() throws URISyntaxException {
		ResponseBuilder nocontent = Response.noContent();
		nocontent = loginCookieManager.logout(nocontent);
		return nocontent.build();
	}

}